
/********************************************************************************
** This file contains the definition of OpenQ10 InfoBar
**
** Created: Thu 29. Nov 13:03:02 2007
**      by: Imran Shahid
**
********************************************************************************/

#include "infobar.h"

#include <QBrush>
#include <QColor>
#include <QFont>
#include <QLabel>
#include <QPalette>
#include <QStatusBar>

InfoBar::InfoBar(QWidget *parent) : QStatusBar(parent)
{
    brushInfoText = new QBrush(QColor(64, 64, 64, 255));
    brushAlarmText = new QBrush(QColor(120, 185, 0, 255));
    brushBkGd = new QBrush(QColor(16, 16, 16, 255));

    brushInfoText->setStyle(Qt::SolidPattern);
    brushAlarmText->setStyle(Qt::SolidPattern);
    brushBkGd->setStyle(Qt::SolidPattern);

    labelWords = new QLabel("Words: ", this);
    labelPages = new QLabel("Pages: ", this);
    labelLines = new QLabel("Lines: ", this);
    labelParas = new QLabel("Paragraphs: ", this);
    labelChars = new QLabel("Characters: ", this);
    labelAlarm = new QLabel("Press F1 to show help card", this);
    labelFileName = new QLabel("untitled.txt", this);
    labelTime = new QLabel("4:40 pm", this);

    //setLabelPalette();

    this->addWidget(labelWords, 75);
    this->addWidget(labelPages, 75);
    this->addWidget(labelLines, 75);
    this->addWidget(labelParas, 90);
    this->addWidget(labelChars, 100);
    this->addWidget(labelAlarm, 200);
    this->addWidget(labelFileName, 100);
    this->addWidget(labelTime, 50);
}

void InfoBar::setPaletteColor()
{
    QPalette palette;

    palette.setBrush(QPalette::Active, QPalette::Base, *brushBkGd);
    palette.setBrush(QPalette::Active, QPalette::Window, *brushBkGd);
    palette.setBrush(QPalette::Active, QPalette::Text, *brushInfoText);
    palette.setBrush(QPalette::Active, QPalette::WindowText, *brushInfoText);

    this->setPalette(palette);
}

void InfoBar::setLabelPalette()
{
    QPalette paletteGrey;
    QPalette paletteGreen;

    paletteGrey.setBrush(QPalette::Active, QPalette::Base, *brushBkGd);
    paletteGrey.setBrush(QPalette::Active, QPalette::Window, *brushBkGd);
    paletteGrey.setBrush(QPalette::Active, QPalette::Text, *brushInfoText);
    paletteGrey.setBrush(QPalette::Active, QPalette::WindowText, *brushInfoText);

    paletteGreen.setBrush(QPalette::Active, QPalette::Base, *brushBkGd);
    paletteGreen.setBrush(QPalette::Active, QPalette::Window, *brushBkGd);
    paletteGreen.setBrush(QPalette::Active, QPalette::Text, *brushAlarmText);
    paletteGreen.setBrush(QPalette::Active, QPalette::WindowText, *brushAlarmText);

    labelWords->setPalette(paletteGrey);
    labelPages->setPalette(paletteGrey);
    labelLines->setPalette(paletteGrey);
    labelParas->setPalette(paletteGrey);
    labelChars->setPalette(paletteGrey);
    labelFileName->setPalette(paletteGrey);
    labelTime->setPalette(paletteGrey);

    labelAlarm->setPalette(paletteGreen);

    QFont font("Verdana", 8, QFont::Normal);
    labelWords->setFont(font); 
    labelPages->setFont(font);
    labelLines->setFont(font);
    labelParas->setFont(font);
    labelChars->setFont(font);
    labelFileName->setFont(font);
    labelTime->setFont(font);
    labelAlarm->setFont(font);

    this->setFont(font);
}
